﻿using System;
using System.Collections.Generic;
using MemoryPack;

namespace Hsenl {
    [MemoryPackable(GenerateType.NoGenerate)]
    public partial interface INode {
        string Name { get; set; }
        NodeStatus NowStatus { get; set; }
        INode Parent { get; set; }
        void AwakeNode(IBehaviorTree tree);
        void EnableNode();
        void DisableNode();
        void DestroyNode();
        void ResetNode();
        void AbortNode();
        bool EvaluateNode();
        NodeStatus TickNode();
        void StartRun();
        void Run();
        void StopRun();
        IteratorList<INode> ForeachChildrenExcludeGrandchild();
        void ForeachChildren<T>(Action<INode, T> action, T userData = default);
        T GetNodeInParent<T>();
        T GetNodeInChildren<T>();
        T[] GetNodesInChildren<T>();
        void GetNodesInChildren<T>(List<T> cache);
    }

    [MemoryPackable(GenerateType.NoGenerate)]
    public partial interface INode<T> : INode where T : class, IBehaviorTree { }
}